#!/usr/bin/env python

'makeTextFile.py -- create text File'

import os

ls = os.linesep

# get filename
while True:
    fname = input('please input file name:\n')
    if os.path.exists(fname):
        print('Error: \'%s\' already exists;' % fname)
    else:
        break
# get file content (text) lines
all_lines = []

while True:
    entry = input('> ')
    if '.' == entry:
        break
    else:
        all_lines.append(entry)

fobj = open(fname, 'w')
fobj.writelines(['%s%s' % (x, ls) for x in all_lines])
fobj.close()
print('Done')
